<template>
  <!-- 手工抄表 独立页面  页面名称-手工抄表-->
  <div class="flManualReading">
    <!-- 搜索框-->
    <div style="padding: 0px 0px">
      <!--      <div style="font-weight:700;padding:10px 10px 10px 50px;">手工抄表</div>-->
      <!--      <div style="border-top:1px solid #E6E6E6;margin:0px 20px;"></div>-->
      <searchComponentsCss :shrinkBoxOpenClose="shrinkBoxOpenClose" :searchData="searchData" :optionsZi="optionsZi" :searchOptionTable="searchOptionTable" @searchCallBack="searchCallBack"></searchComponentsCss>
      <!-- 收缩框 -->
      <!-- {{numSearch}} -->
      <div class="shrinkBox" @click="shrinkBoxOpenClose = !shrinkBoxOpenClose">
        <i :class="
                        shrinkBoxOpenClose
                            ? 'el-icon-arrow-up'
                            : 'el-icon-arrow-down'
                    " v-if="numSearch > 8"></i>
      </div>
      <div style="border-top: 1px solid #e6e6e6; margin: 0 30px"></div>
      <div class="right_row" style="padding: 25px 30px">
        <!-- padding: 25px 30px; -->
        <!-- 导入导出 -->
        <!-- 无下载模板      回删 -->
        <!-- 模板导入导出下载 -->
        <importXlsx class="importX" :multipleSelection="multipleSelection" :suoS="suoS" v-if="but_imp" :importUrl="importUrl" @handleSuccessImport="handleSuccessImport" />
        <!-- 右侧搜索组件 -->
        <rightButtons class="buttons" style="float: right; padding: 10px" :configurationData="searchData" :btn-switch-configuration="true" @sunS_F="sunS_F" @emptySearch="emptySearch" v-if="but_pz" @configuration="configuration" @goFatherComponent="goFatherComponent"></rightButtons>
        <!-- -------------------- -->
        <!-- <div class="buttons" style="float:right;padding:10px;"> -->
        <!-- <el-button
            type="primary"
            size="mini"
            plain
            @click="sunS_F"
            icon="el-icon-search"
        >搜索</el-button>-->
        <!-- </div> -->
      </div>
    </div>
    <!-- usingSum 用水量 -->
    <div class="out">
      <!--数据列表-->
      <!-- 字典 -->
      <!-- {{dataAttribute}} -->
      <dictionaries :searchData="searchData" :modelType="modelType" @optionData="dictionariesCallBack"></dictionaries>
      <el-table ref="multipleTable" :data="dataAttribute" v-loading.body="loading" border fit highlight-current-row size="mini" :cell-style="{ padding: '5px 0' }" @selection-change="handleSelectionChange" @sort-change="sortChangeTable" max-height="511px">
        <el-table-column align="center" type="selection" :show-overflow-tooltip="true" width="45"></el-table-column>
        <el-table-column align="center" label="序号" :index="indexMethod" type="index" width="54px"></el-table-column>
        <!-- 数据列遍历 -->
        <el-table-column align="center" v-for="item in searchData" v-if="item.tableSign && item['configurationSign']" :key="item.id" :label="item.CN" :prop="item.EN" :show-overflow-tooltip="true" :sortable="customMethod" min-width="140px">
          <template slot-scope="scope">
            <div v-if="!but_cb">
              {{
                                item.type === "select"
                                    ? optionDatas(
                                          item.typeGroupCode
                                              ? optionsZi[item.EN]
                                              : searchOptionTable[item.EN],
                                          scope.row[item.EN]
                                      )
                                    : scope.row[item.EN]
                            }}
            </div>

            <!-- @change="handleEdit(scope.$index,scope.row)" -->
            <!-- @keyup.enter.native="inputFoucs(scope.$index,scope.row[item.EN],item.id)" -->
            <!-- v-model="scope.row.readingValue" -->

            <div v-else class="thisReadingBody">
              <div v-if="
                                    (item.EN === 'readingValue' &&
                                        scope.row.cbStatus === 1) ||
                                    (item.EN === 'readingValue' &&
                                        scope.row.cbStatus === 0)
                                " class="thisReading" @click="okl(scope.$index, scope.row)">
                <!--   -->
                <el-input v-if="scope.$index === currentId && scope.row.cbStatus === 0" v-focus v-model="scope.row[item.EN]" size="mini" @keyup.enter.native="
                                        inputFoucs(
                                            scope.$index,
                                            scope.row[item.EN],
                                            scope.row.id,
                                            scope.row
                                        )
                                    " @blur="
                                        inputBlur(
                                            scope.$index,
                                            scope.row[item.EN],
                                            scope.row.id,
                                            scope.row
                                        )
                                    ">
                  <!-- @change="handleEdit(scope.$index,scope.row)"

                                    -->
                  <!-- @keyup.enter.native="inputFoucs(scope.$index,scope.row[item.EN],item.id)" -->
                  <!-- v-model="scope.row.readingValue"v-focus -->
                </el-input>
                <el-input v-else-if="scope.$index === currentId && scope.row.cbStatus === 1" v-model="scope.row[item.EN]" size="mini" @keyup.enter.native="
                                        inputFoucs(
                                            scope.$index,
                                            scope.row[item.EN],
                                            scope.row.id,
                                            scope.row
                                        )
                                    " @blur="
                                        inputBlur(
                                            scope.$index,
                                            scope.row[item.EN],
                                            scope.row.id,
                                            scope.row
                                        )
                                    ">
                  <!-- @change="handleEdit(scope.$index,scope.row)"

                                    -->
                  <!-- @keyup.enter.native="inputFoucs(scope.$index,scope.row[item.EN],item.id)" -->
                  <!-- v-model="scope.row.readingValue" -->
                </el-input>
                <span v-else>{{scope.row[item.EN]}}</span>
              </div>
              <!-- 0未抄 1已抄 2已审核 3已结束 -->
              <div v-else-if="item.EN === 'cbStatus'">
                <span v-if="scope.row[item.EN] == 0" style="color: #666666">{{
                                        item.type === "select"
                                            ? optionDatas(
                                                  item.typeGroupCode
                                                      ? optionsZi[item.EN]
                                                      : searchOptionTable[
                                                            item.EN
                                                        ],
                                                  scope.row[item.EN]
                                              )
                                            : scope.row[item.EN]
                                    }}</span>
                <span v-if="scope.row[item.EN] == 1" style="color: #71cb43">{{
                                        item.type === "select"
                                            ? optionDatas(
                                                  item.typeGroupCode
                                                      ? optionsZi[item.EN]
                                                      : searchOptionTable[
                                                            item.EN
                                                        ],
                                                  scope.row[item.EN]
                                              )
                                            : scope.row[item.EN]
                                    }}</span>
                <span v-if="scope.row[item.EN] == 2" style="color: #c80010">{{
                                        item.type === "select"
                                            ? optionDatas(
                                                  item.typeGroupCode
                                                      ? optionsZi[item.EN]
                                                      : searchOptionTable[
                                                            item.EN
                                                        ],
                                                  scope.row[item.EN]
                                              )
                                            : scope.row[item.EN]
                                    }}</span>
                <span v-if="scope.row[item.EN] == 3" style="color: #5884de">{{
                                        item.type === "select"
                                            ? optionDatas(
                                                  item.typeGroupCode
                                                      ? optionsZi[item.EN]
                                                      : searchOptionTable[
                                                            item.EN
                                                        ],
                                                  scope.row[item.EN]
                                              )
                                            : scope.row[item.EN]
                                    }}</span>
              </div>
              <span v-else>{{
                                item.type === "select"
                                    ? optionDatas(
                                          item.typeGroupCode
                                              ? optionsZi[item.EN]
                                              : searchOptionTable[item.EN],
                                          scope.row[item.EN]
                                      )
                                    : scope.row[item.EN]
                            }}</span>
            </div>
            <!-- <span v-else>{{item.type === 'select' ? optionDatas(item.typeGroupCode?optionsZi[item.EN]:searchOptionTable[item.EN],scope.row[item.EN]):scope.row[item.EN]}}</span> -->
          </template>
        </el-table-column>
      </el-table>
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[10, 20, 50, 100]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="pagetotal"></el-pagination>
    </div>
  </div>
</template>

<script>
import {
  SAVE_CHECK_BOXS,
  GAIN_CHECK_BOXS,
} from '@/views/components/FLPage/fun/checkBoxFun'
//引入组件
import {
  SearchCForL,
  searchComponents,
  searchComponentsCss,
  buttonhurdle,
  rightButtons,
  dictionaries,
  importXlsx,
} from '@/views/components/FLPage'
import {
  addFlManualReading, //增加
  deleteFlManualReading, //删除
  searchFlManualReading, //分页查询
  // modifyFlManualReading, //修改
  getFlManualReading, //根据ID获取
  exprotXls, //导出xlsx数据
  downTem, //导出下载模板
  inputReadNum, //录入读数
} from '@/api/admin/flManualRead/index'
export default {
  components: {
    SearchCForL,
    searchComponents,
    searchComponentsCss,
    buttonhurdle,
    rightButtons,
    dictionaries,
    importXlsx,
  },
  data() {
    return {
      numSearch: 0,
      but_pz: false,
      but_imp: false,
      but_cb: false,
      loading: false,
      //   收缩框开关
      shrinkBoxOpenClose: false,
      //搜索框
      suoS: {},
      //瀑布数据
      //   搜索组件的数据
      searchData: [
        {
          EN: 'id',
          CN: '主键',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
        },
        // {
        //   EN: "sellingareaCode",
        //   CN: "营业厅",
        //   value: "",
        //   type: "input",
        //   option: [],
        //   Exp: "^.{3,20}$",
        //   err: "长度为3-20的所有字符!",
        //   result: true,
        //   sign: true,
        //   searchSign: true,
        //   addSign: true,
        //   tableSign: true,
        //   examineSign: true,
        //   examineDisabled: false,
        //   modificationSign: true
        // },
        {
          EN: 'areaCode',
          CN: '片区',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          dictTable: {
            table: 'fl_area',
            id: 'id',
            name: 'name',
          },
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'watermeterNo',
          CN: '水表编号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'hangbookCode',
          CN: '抄表手册',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          isMultiple: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          dictTable: {
            table: 'fl_book',
            id: 'id',
            name: 'name',
          },
          configurationSign: true,
        },
        {
          EN: 'readingUser',
          CN: '所属人员',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          dictTable: {
            table: 'base_user',
            id: 'id',
            name: 'name',
          },
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'readingUserName',
          CN: '所属人员',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: false,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'watermeterAddress',
          CN: '安装位置',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'watermeterState',
          CN: '表状态',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          typeGroupCode: 'meter_status',
          configurationSign: true,
        },
        {
          EN: 'taskStartDate',
          CN: '任务开始日期',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'taskMonth',
          CN: '任务月份',
          value:
            new Date().getFullYear() +
            '-' +
            (new Date().getMonth() + 1 < 10
              ? '0' + (new Date().getMonth() + 1)
              : new Date().getMonth() + 1),
          type: 'dateMonth',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: false,
          tableSign: false,
          examineSign: false,
          examineDisabled: false,
          modificationSign: false,
        },

        {
          EN: 'cbStatus',
          // CN: "抄表状态 0未抄，1已抄，2已审核，3已结束",
          CN: '抄表状态',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          typeGroupCode: 'reading_status',
          configurationSign: true,
        },
        {
          EN: 'watermeterRange',
          CN: '水表量程',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          typeGroupCode: 'rang_value',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'readingValue',
          CN: '本期读数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^[0-9]*$',
          err: '只能输入数字',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'readingValue1',
          CN: '本期读数止',
          value: '',
          type: 'input',
          option: [],
          Exp: '^[0-9]*$',
          err: '只能输入数字',
          result: true,
          sign: true,
          searchSign: true,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'usingSum',
          CN: '合计用量',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'usingSum1',
          CN: '合计用量止',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: true,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'thisCbDate',
          CN: '本次抄表日期',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'lastReadingValue',
          CN: '上期读数',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'lastUsing',
          CN: '上期用量',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'lastCbDate',
          CN: '上次抄表日期',
          value: '',
          type: 'date',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'customerName',
          CN: '客户名称',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: true,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'customerNo',
          CN: '客户编号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'customerNoStart',
          CN: '客户编号起',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: true,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'customerNoEnd',
          CN: '客户编号止',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: true,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'waterproperty',
          CN: '用水性质',
          value: '',
          type: 'select',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          // typeGroupCode: "waterproperty",
          dictTable: {
            table: 'fl_water_use_property',
            id: 'id',
            name: 'name',
          },
          configurationSign: true,
        },
        {
          EN: 'customerTel',
          CN: '联系电话',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },

        {
          EN: 'bookName',
          CN: '抄表手册',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: false,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'bookNo',
          CN: '手册编码',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'queueNo',
          CN: '序号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },

        {
          EN: 'xq',
          CN: '小区',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'loudongId',
          CN: '楼栋号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'unitId',
          CN: '单元号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },
        {
          EN: 'roomNumber',
          CN: '门牌号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: false,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: true,
        },

        {
          EN: 'jzqId',
          CN: '集中器编号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'cjqId',
          CN: '采集器编号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'moduleAddr',
          CN: '模块地址',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'dma',
          CN: 'dma分区',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },

        {
          EN: 'watMeterAddrCode',
          CN: '表计地址码',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },

        {
          EN: 'jingDu',
          CN: '经度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'weiDu',
          CN: '纬度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'gangYinHao',
          CN: '钢印号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'readLongitude',
          CN: '抄表人定位经度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'readLatitude',
          CN: '抄表人定位纬度',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'imgMeterEnv',
          CN: '',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'imgMeterLocation',
          CN: '',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'imgMeterNum',
          CN: '',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'taskId',
          CN: '所属任务id',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'type',
          CN: '水表类型 1手动抄表，5抄表机抄表',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'channelNumber',
          CN: '通道号',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },
        {
          EN: 'jxCbjProtocol',
          CN: '捷先抄表机协议',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          configurationSign: false,
        },

        {
          EN: 'machineType',
          CN: '抄表机类型',
          value: '',
          type: 'input',
          option: [],
          Exp: '^.{3,20}$',
          err: '长度为3-20的所有字符!',
          result: true,
          sign: true,
          searchSign: false,
          addSign: true,
          tableSign: true,
          examineSign: true,
          examineDisabled: false,
          modificationSign: true,
          typeGroupCode: 'read_meter_factory',
          configurationSign: false,
        },
      ],
      //添加弹窗的数据模型
      diaDataAdd: {
        yyqName: '',
        pqName: '',
        pqNum: '',
        BH: '',
      },
      //删除----Start----------------------------------------
      deleteDataList: [],
      //删除----End----------------------------------------

      //查看----Start----------------------------------------
      //查看的弹窗控制器
      DialogVisibleExamine: false,
      //查看的数据
      examineData: {},
      //查看----End----------------------------------------

      //表格数据
      //后端传来的数据
      dataAttribute: [],
      //表格选中
      multipleSelection: [],
      //分页
      currentPage: 1, //当前页
      pagesize: 10, //每页条数
      pagetotal: 0, //总条数
      // 导入的请求地址
      importUrl: `/api/cb/flManualReading/importXls`,
      modelType: 'table',
      optionsZi: [],
      searchOptionTable: [],
      focusIndex: -1,
      currentLineIndex: -1,
      inputOpenOrClose: false,
      // 当前选中的单元格  行的id
      currentId: -1,
    }
  },
  computed: {
    // 字典
    optionDatas() {
      return function (arr, val) {
        // console.log(arr,val,666666633333333);

        // console.log(arr[val],'why');
        if (arr) {
          // console.log(arr[val], val)
        }
        if (arr) {
          for (let i = 0; i < arr.length; i++) {
            if (arr[i].value === val) {
              // console.log(arr[i].label)
              return arr[i].label
            }
          }
        }
      }
    },
    customMethod() {
      return 'custom'
    },
  },
  directives: {
    focus: {
      // 指令自定义   自动获取焦点
      inserted: function (el) {
        console.log(el.children[0], el.children[0].focus())
        // el.children[0].focus();
      },
    },
  },
  async created() {
    this.but_pz = this.$store.state.user.elements['flManualRead:but_pz']
    this.but_imp = this.$store.state.user.elements['flManualRead:but_imp']
    this.but_cb = this.$store.state.user.elements['flManualRead:but_cb']
    if (this.but_cb) {
      this.but_cb = true
    } else {
      this.but_cb = false
    }
    this.getSSearchNum()
    //获取保存的’配置‘
    //1.ajax

    let userId = this.$store.state.user.id
    let routerName = this.$route.path
    console.log(userId)
    let peizhiData = await GAIN_CHECK_BOXS(userId, routerName)
    console.log(peizhiData, 55666)

    //2.判断数据库里面是否有 以前存过的配置信息
    if (peizhiData['ATE'] == 'ERROR') {
      //这表示没获取到，这种情况用原来的searchData
    } else {
      //这表示获取到了‘配置’，所以使用新的数值
      //3.解析(序列化)
      if (peizhiData.stringData != '') {
        this.searchData = JSON.parse(peizhiData.stringData)
      }
    }
    console.log('this.searchData--', this.searchData)
    this.forData(this.currentPage, this.pagesize, this.suoS)
  },
  methods: {
    // 搜索框
    getSSearchNum() {
      let searchData = this.searchData
      let num = 0
      for (let i = 0; i < searchData.length; i++) {
        const element = searchData[i]
        if (element.searchSign) {
          num += 1
        } else {
          num = num
        }
      }
      this.numSearch = num
    },
    //排序
    sortChangeTable(obj) {
      // { column, prop, order }
      // 上升
      console.log(obj)
      let prop = obj.prop
      // 排序  需求  将驼峰形式的字段 改为 下划线形式的字段
      let abc = prop.replace(/([A-Z])/g, '_$1').toLowerCase()
      console.log(abc, 999)
      if (obj.order === 'ascending') {
        let suoS = this.suoS
        suoS.sortName = abc
        // suoS.sortName = obj.prop
        suoS.sortType = obj.order
        this.forData(this.currentPage, this.pagesize, suoS) //刷新列表
      } else if (obj.order === 'descending') {
        let suoS = this.suoS
        suoS.sortName = abc
        // suoS.sortName = obj.prop
        suoS.sortType = obj.order
        this.forData(this.currentPage, this.pagesize, suoS) //刷新列表
        // 下降
      } else {
        // 正常
        let suoS = this.suoS
        suoS.sortName = abc
        // suoS.sortName = obj.prop
        suoS.sortType = ''
        this.forData(this.currentPage, this.pagesize, suoS) //刷新列表
        // this.forData(this.currentPage, this.pagesize, this.suoS); //刷新列表
      }
    },
    // 序号
    indexMethod(index) {
      var currentPage = this.currentPage
      var pagesize = this.pagesize
      this.$nextTick(function () {
        currentPage = this.currentPage
        pagesize = this.pagesize
      })
      // console.log(currentPage,pagesize,'996');
      // console.log(currentPage*pagesize+index - 9);
      return currentPage * pagesize - pagesize + 1 + index
    },
    //配置的子组件通知
    async goFatherComponent(OverData) {
      //1.修改父组件的视图***************
      this.searchData = JSON.parse(JSON.stringify(OverData))
      //2.保存’配置‘的更改
      let obj = {}
      //三个参数都是string类型***********
      obj['userId'] = this.$store.state.user.id //1
      obj['routerName'] = this.$route.path ///jiChuZiLiao/flBook
      obj['stringData'] = JSON.stringify(OverData) //相当于this.searchData转成了字符串格式    [{"EN":"id","CN":"主键","value":""...
      //封装好的发请求方法*****************
      let save_check_boxs = await SAVE_CHECK_BOXS(obj)
    },

    handleSuccessImport(newValue) {
      console.log(newValue, 8888)
      if (newValue == '导入成功') {
        console.log(newValue, 9999)
        this.forData(this.currentPage, this.pagesize, this.suoS)
      }
    },
    // 配置
    configuration(msg) {
      if (msg == '配置') {
        console.log(msg)
      }
    },
    // 重置
    emptySearch(msg) {
      if (msg == '重置') {
        this.suoS = {}
        this.currentPage = 1
        this.forData(this.currentPage, this.pagesize, this.suoS)
      }
    },
    clickFocus(row, column, cell, event) {
      // console.log(cell,event,89889);
      console.log(row, column, cell, event, 89889)
      // 当前选中的id
      this.currentId = row.$index
    },
    // 改变抄表状态
    async changeStatus(row, readNum) {
      const res = await inputReadNum(row, readNum)
      if (res.code === 20001) {
        this.$message({
          message: res.message,
          type: 'warning',
        })
        return false
      }
      return true
      console.log(res)
    },
    async inputBlur(index, readNum, id, row) {
      this.toWatermeterRangeLabel(row.watermeterRange)
      let watermeterRangeLabel = this.watermeterRangeLabel
      console.log('比较数据', readNum, watermeterRangeLabel)
      if (index === this.currentId) this.currentId = -1
      console.log(index, readNum, 888, id)
      // console.log(this.focusIndex == index,555);
      // this.focusIndex == index
      index = index + 1
      let result = ''
      if (readNum && isNaN(readNum)) {
        readNum = ''
        // for (let i = 0; i < this.dataAttribute.length; i++) {
        //   const element = this.dataAttribute[i];
        //   this.dataAttribute[i][]

        // }
        this.$message({
          message: '请输入数字类型',
          type: 'warning',
        })
      } else if (readNum > watermeterRangeLabel) {
        this.$message({
          message: '读数不能超过水表量程',
          type: 'warning',
        })
      } else {
        // ---
        if (readNum) {
          result = await this.changeStatus(id, readNum)
        } else {
          return
        }
      }
      // 刷新页面
      this.forData(this.currentPage, this.pagesize, this.suoS)
    },
    toWatermeterRangeLabel(value) {
      let optionsZi = this.optionsZi
      let arr = optionsZi['watermeterRange']
      for (let i = 0; i < arr.length; i++) {
        const element = arr[i]
        if (arr[i].value === value) {
          this.watermeterRangeLabel = arr[i].label
        }
      }
    },
    async inputFoucs(index, readNum, id, row) {
      console.log(this.currentPage, '页码')
      console.log(index, readNum, 888, id, isNaN(readNum))
      this.toWatermeterRangeLabel(row.watermeterRange)
      let watermeterRangeLabel = this.watermeterRangeLabel
      console.log('比较数据', readNum, watermeterRangeLabel)
      // 获取水表量程
      // row.watermeterRange
      // console.log(this.focusIndex == index,555);
      // this.focusIndex == index
      index = index + 1
      let result = ''
      let readNumq = Number(readNum)
      let watermeterRangeLabelq = Number(watermeterRangeLabel)
      console.log('比较数据', readNumq, watermeterRangeLabelq)
      // ---
      // console.log(aa,996,aa===NaN,typeof(aa));
      if (isNaN(readNum)) {
        this.$message({
          message: '请输入数字类型',
          type: 'warning',
        })
      } else if (readNumq > watermeterRangeLabelq) {
        this.$message({
          message: '读数不能超过水表量程',
          type: 'warning',
        })
      } else {
        console.log(2)
        //*****9999 */
        if (readNum) {
          result = await this.changeStatus(id, readNum)
        } else {
          this.openResult()
          return false
        }
        console.log(this.currentPage, 951)
        // 刷新页面
        // debugger
        this.forData(this.currentPage, this.pagesize, this.suoS)
        if (this.suoS.cbStatus === '') {
          if (!result) return false
          if (!readNum) {
            // this.openResult()
            // return false
          }
          // 刷新页面
          //this.forData(this.currentPage, this.pagesize, this.suoS);
          this.currentId = index > this.pagesize ? -1 : index
          console.log(this.currentId, '下一个选择框的下标')

          this.focusIndex = index
          // console.log(this.focusIndex,'??');
          // 传的参数   当前的行数    此单元格的值

          // this.forData(this.currentPage, this.pagesize, this.suoS);
          // 问题：currentId已经改变   但是下一个input不显示
        }
      }
    },
    openResult() {
      this.$alert('抄录为空', '提示', {
        confirmButtonText: '确定',
        callback: (action) => {
          this.$message({
            type: 'info',
            message: '请继续抄录',
          })
        },
      })
    },
    // 每一行的index
    okl(index, row) {
      console.log(index, row, 666)

      // focusIndex
      // this.currentLineIndex = index
      this.currentId = index
    },
    // 字典组件回调
    dictionariesCallBack([a = {}, b = {}]) {
      // 正常字典
      this.optionsZi = a
      // 跨表字典
      this.searchOptionTable = b
      // console.log(a,b,66688);
      this.forData(this.currentPage, this.pagesize, this.suoS)
    },
    //搜索
    sunS_F() {
      this.currentPage = 1
      this.forData(this.currentPage, this.pagesize, this.suoS) //刷新列表
    },
    //查询组件回调
    searchCallBack(newData) {
      console.log(newData)
      //组装数据（newData是个数组）

      let obj = {}
      for (let i = 0; i < newData.length; i++) {
        obj[newData[i].EN] = newData[i].value
      }
      console.log(obj)
      this.suoS = obj
    },
    //渲染数据初始

    forData(page, size, searchData) {
      this.loading = true
      for (let item in searchData) {
        if (Array.isArray(searchData[item])) {
          searchData[item] = searchData[item].join(',')
        }
      }
      searchFlManualReading(page, size, searchData)
        .then((response) => {
          this.pagetotal = response.data.total
          this.dataAttribute = response.data.list
          this.loading = false
        })
        .catch((err) => {
          this.loading = false
        })
    },
    //表格选中事件
    handleSelectionChange(val) {
      this.multipleSelection = val
      //传递删除的参数
      this.deleteDataList = val
    },

    //分页
    handleSizeChange(val) {
      console.log('每页 ' + val + ' 条')
      this.pagesize = val
      this.forData(this.currentPage, val, this.suoS)
    },
    handleCurrentChange(val) {
      console.log('当前页: ' + val)
      this.currentPage = val
      this.forData(val, this.pagesize, this.suoS)
    },
    // 下载模板请求
    exprotXlsx: exprotXls,
    downloadFile: downTem,
  },
  // watch:{
  //   currentId:{

  //   }
  // }
}
</script>

<style scoped src="@/styles/allCssP.css"></style>
<style lang="scss" scoped>
.thisReadingBody {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.thisReading {
  height: 35px;
  line-height: 35px;
  -webkit-appearance: none;
  /* background-color: #FFF; */
  background-image: none;
  border-radius: 4px;
  border: 1px solid #dcdfe6;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  color: #606266;
  display: inline-block;
  font-size: inherit;

  outline: 0;
  padding: 0 0;
  -webkit-transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
  transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
  width: 100%;
}
.flManualReading {
  .right_row {
    padding: 25px 30px;
    display: flex;
    align-items: center;
    position: relative;

    .buttons {
      position: absolute;
      padding: 0px !important;
      right: 30px;
    }

    .buttonhurdle {
      padding: 0px !important;
    }
  }

  .shrinkBox {
    text-align: center;
    font-weight: 700;
    font-size: 20px;
    height: 25px;
    // border-bottom:1px solid #E6E6E6;
  }

  .out {
    // 解决table表格线错位
    /deep/ .el-table--mini {
      .gutter {
        display: table-cell !important;
      }

      .el-checkbox__inner {
        width: 12px;
        height: 12px;
      }

      // 改变表头的高度  改为45px
      /deep/.el-table__header-wrapper {
        .el-table__header {
          .has-gutter {
            tr {
              th {
                padding: 5px 0 !important;
                height: 34px;
                line-height: 34px;
              }

              // .is-leaf{
              //   padding: 5px 0 !important;

              // }
            }
          }
        }
      }

      // 表头操作固定定位
      /deep/.el-table__fixed-right {
        .el-table__header {
          thead {
            tr {
              th {
                padding: 5px 0 !important;
                height: 34px;
                line-height: 34px;

                .cell {
                  // padding-bottom: 5px !important;
                  //   height: 34px;
                  //   line-height: 34px;
                }
              }
            }
          }
        }
      }

      .el-table__body-wrapper {
        .el-table__body {
          tbody {
            .el-table__row {
              height: 47px !important;
            }
          }
        }
      }

      .el-input__inner {
        border: 0;
      }
    }

    .el-pagination {
      text-align: left;
      margin-top: 20px;
    }
  }
}
</style>
